<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <title>个人中心</title>
    <link rel="stylesheet" type="text/css" href="./newstyle/css/loaders.min.css"/>
    <link rel="stylesheet" type="text/css" href="./newstyle/css/loading.css"/>
    <link rel="stylesheet" type="text/css" href="./newstyle/css/base.css"/>
    <link rel="stylesheet" type="text/css" href="./newstyle/css/style.css"/>
      <script src="./newstyle/js/jquery.min.js" type="text/javascript" charset="utf-8"></script>
    <script type="text/javascript">
        $(window).load(function(){
            $(".loading").addClass("loader-chanage")
            $(".loading").fadeOut(300)
        })
    </script>
        <script type="text/javascript">
        window.onload=function(){
            myPaymentValue=myValue1();
            if(myPaymentValue==0){//微信支付
                $("#WeChat").siblings("div").addClass('notShow');
                $("#WeChat").removeClass('notShow');
                //调用安卓的方法进行请求java后台，得到json字符串，alert（json）
                var order_type="wechat";
                _json=JSON.parse(androidTojava(order_type));
                var _qr_code="";
                with(_json) {
                  _qr_code = data.qr_code;
                }
                $("#weChat_PayMchName").innerHTML=getPayMchName();
                $("#weChat_TwoDimensionCode").qrcode({
                    //render: "canvas", //也可以替换为table
                    foreground: "#330099",
                    background: "#FFFFFF",
                    width: 200,
                    height: 200,
                    text: _qr_code
                });

            }else if(myPaymentValue==1){//支付宝支付
                $("#alipay").siblings("div").addClass('notShow');
                $("#alipay").removeClass('notShow');
                var order_type="alipay";
                androidTojava(order_type);
            }else if(myPaymentValue==2){//刷卡支付
                alert("功能未实现");
            }else if(myPaymentValue==3){//现金支付
                $("#xianjin").siblings("div").addClass('notShow');
                $("#xianjin").removeClass('notShow');
                //调用后台方法拿到实付金额
                var pay_amount=payment.getPayAmount();
                document.getElementById("money").innerText=pay_amount+"元";
            }else if(myPaymentValue==4){//延迟支付

            }else{//传值错误
                alert("后台传值错误");
            }
        }
        // <!--从后台拿到传过来的值 0微信 1支付宝 2刷卡 3现金 4延迟-->
        function myValue1(){
            var v=payment.payValue();
            return v;
        }
        // <!--android调用第三方接口 返回微信二维码链接-->
        function androidTojava(order_type){
          var result=payment.weChatTwoDimensionCode(order_type);
          //拿到json中"qr_code" : "weixin://wxpay/bizpayurl?pr=qckSTp4",
          //传入后台生成二维码
          return result;
        }
        function getPayMchName() {
          var result=payment.weChatPayMchName();
          return result;
        }
        //点击提交更新该订单
        function updateOrder(){
            var result=payment.updateOrder();
            if(result=="成功"){
                alert("支付完成");//跳转页面到商品列表页面
                payment.toActivity();
            }else{
                alert("支付失败");
            }
        }
    </script>
        <style type="text/css">
    .clearfloat{
        text-align: center;
        padding-top: 20px;
    }
    .clearfloat p{
        font-size: 2em;
        height: 50px;
    }
    .clearfloat img{
        width: 200px;
        height: 200px; 
    }
    </style>
    </head>
<!--loading页开始-->
<div class="loading">
    <div class="loader">
        <div class="loader-inner pacman">
          <div></div>
          <div></div>
          <div></div>
          <div></div>
          <div></div>
        </div>
    </div>
</div>
<!--loading页结束-->
<body>
    <header class="top-header">
        <a class="icona" href="javascript:history.go(-1)">
                <!-- <img src="./newstyle/images/left.png"/> -->
        </a>
        <h3>支付方式</h3>
        <a class="iconb" href="#">
        </a>
    </header>

    <div class="login" style="margin-top: 0;">
        <form>
            <!--微信支付显示-->
<!-- <div id="WeChat" class="WeChat">
    <h2>请用微信扫码付款</h2><br>
    <div id="weChat_TwoDimensionCode"></div>
</div> -->

            <div class="clearfloat"> 
                <p>请用支付宝扫码付款</p>
                <img  src="icon/ceshi.png"  width="200px" height="200px"/>
            </div>
            <a href="javascript:void();" class="gobuy-btn"  onclick="updateOrder()">
                提交
            </a>
        </form>
    </div>

</body>
</html>







 